import datetime
from exts import db


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(225), nullable=False)
    password = db.Column(db.String(225), nullable=False)
    phone = db.Column(db.String(11), nullable=True, unique=True)
    create_time = db.Column(db.DateTime, default=datetime.datetime.now)
    is_delete = db.Column(db.Boolean, default=False)
    # 是否是管理员
    is_admin = db.Column(db.Boolean, default=False)

    def __str__(self):
        return self.username
